<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>layui</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="__static/lib/layui-v2.5.5/css/layui.css" media="all">
    <link rel="stylesheet" href="__static/css/public.css" media="all">
    <style>
        body {
            background-color: #ffffff;
        }
    </style>
</head>
<body>
<div class="layui-form layuimini-form">
    <div class="layui-form-item">
        <label class="layui-form-label required">物品名称</label>
        <div class="layui-input-inline">
            <input type="text" name="bomname" lay-verify="required" lay-reqtext="请输入物品名称" placeholder="请输入"
                   class="layui-input" value="{$data.bomname|default=''}">
            <tip>填写物品名称</tip>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">物品分类</label>
        <div class="layui-input-inline">
            <select class="role" name="bomclassify" lay-verify="required" lay-search="" lay-verify="required"
                    autocomplete="off">>
                <option value="">请选择分类</option>
                {volist name="datesort" id='d'}
                <option value="{$d.sortid}" {if $data.bomclassify eq $d.sortid} selected{/if}>{$d.sortname}</option>
                {/volist}
            </select>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label required">物品数量</label>
        <div class="layui-input-inline">
            <input type="number" name="bomcount" lay-verify="required" lay-reqtext="物品数量不能位空" placeholder="请输入物品数量"
                   value="{$data.bomcount|default=''}"
                   class="layui-input mobile">
        </div>
    </div>

    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">备注</label>
        <div class="layui-input-block">
            <textarea style="width: 190px;" name="remark" placeholder="请输入备注" class="layui-textarea">{$data.remark|default=''}</textarea>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn layui-btn-normal" lay-submit lay-filter="saveBtn">确认保存</button>
        </div>
    </div>
    <div style="display: none;">
        <input type="hidden" name="bomid" value="{$data.bomid|default=''}">
    </div>
</div>
</div>
<script src="__static/lib/layui-v2.5.5/layui.js" charset="utf-8"></script>
<script>
    layui.use(['form', 'laydate', 'table'], function () {
        var form = layui.form,
            layer = layui.layer,
            table = layui.table,
            laydate = layui.laydate,
            $ = layui.$;


        //监听提交
        form.on('submit(saveBtn)', function (data) {
            var url = '/manage/bom_save';
            layer.load(2);
            $.post(url, data.field, function (d) {
                var index = layer.alert(d.msg, '', function () {
                    layer.close(index);
                    var iframeIndex = parent.layer.getFrameIndex(window.name);
                    parent.layer.close(iframeIndex);
                });
                layer.closeAll('loading');
            });
        });
    });


</script>
</body>
</html>